<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateQuestionsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('questions', function (Blueprint $table) {
            $table->bigIncrements('id')->comment('ID');
            $table->bigInteger('employees_id')->nullable()->comment('员工ID');
            $table->string('region')->comment('区域');
            $table->text('description')->comment('事故现象描述');
            $table->string('status')->default('pending')->comment('状态[pending:待处理,processing:处理中,rectification:暂时处理,resolved:已处理]');
            $table->text('notes')->nullable()->comment('备注');
            $table->timestamp('created_at')->nullable()->comment('创建时间');
            $table->timestamp('updated_at')->nullable()->comment('修改时间');
            $table->timestamp('deleted_at')->nullable()->comment('删除时间');
        });

        DB::statement('alter table'. ' ' .config('database.connections.mysql.prefix', '').'questions comment "问题清单表"');

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('questions'); // 问题清单表
    }
}
